#include<stdio.h>
int main()
{
	int i,b;
	double price,a;
	char c;
	scanf("%lf%d %c",&a,&b,&c);
	
	switch(b)
	{
		case 90:price=a*6.95;break;
		case 93:price=a*7.44;break;
		case 97:price=a*7.93;break;
		default:price=0;break;
	}
	if(c=='m'){
		price=price*(1-0.05);
	}
	else{
		price=price*(1-0.03);
	}
	printf("price=%.2lf",price);
}
